home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / LONGFI.ZIP / LONG_FIX.DOC < prev    next >
Encoding:
Text File  |  1994-10-07  |  2.9 KB  |  72 lines

  1. LONG_FIXED Programmers Guide
  2. Version 1.0
  3. October 6, 1994
  4.  
  5. LONG_FIXED is a C++ Class for 64 bit fixed-point arithmetic. It allows a
  6. programmer the ability to write programs for Real numbers without a math
  7. coprocessor at math coprocessor speeds.
  8.  
  9. LONG_FIXED numbers allow 9 significant digits before and after the decimal
  10. point.
  11.  
  12. The LONG_FIXED Class is very easy to use. You only have to learn one
  13. function. All the rest of the functionality of this Class comes from
  14. operator overloading. 
  15.  
  16. All the standard operators are available:
  17.  +  -  *  /  >>  <<  +=  -=  *=  /=  >>=  <<=  ==  !=  >  >=  <  <=
  18.  
  19. You may have noted the ommission of the % ++ -- operators. I felt that
  20. when dealing with Real numbers these didn't make sense. This doesn't
  21. mean you can't derive a Class from this one that includes them. You may
  22. also have noted the operators >> << though not normally associated with
  23. Real numbers for speed purposes I added them. (Shifting by 1 is much faster
  24. that multiplying or dividing by 2).
  25.  
  26. I also added the functions abs(), round(), ceil() and floor(). These could
  27. have been put into a derived class but I felt that they are useful functions
  28. and that, in the cases of round, ceil, and floor I needed a way to convert
  29. LONG_FIXED to longs and ints.
  30.  
  31. The only new function you will see in the Class is the value() function,
  32. which converts LONG_FIXED to long doubles.
  33.  
  34. The last thing I added was the ostream << operator to make displaying the
  35. values of LONG_FIXED easier. It just converts the LONG_FIXED number to a
  36. long double and adds the long double to the ostream.
  37.  
  38. I added two example programs to use with the libraries. The first is
  39. REAL.EXE. This program uses almost all the operators in the Class and
  40. can be used as further documention. The second TEST.EXE does a comparison
  41. of a LONG_FIXED and double times for execution. (TEST.EXE can only be
  42. compiled using Borland 3.1, the Timer Class seems to be missing from 4.0).
  43.  
  44. You will find when you run TEST that the times will be similar if your
  45. computer has a math coprocessor (sometimes LONG_FIXED will be slower,
  46. especially for fast 486DXs). If the computer does not have a coprocessor
  47. you will see significant speed improvements with LONG_FIXED.
  48.  
  49. The libraries are compiled using the large memory model and requires the
  50. linking of the floating point library. (I needed them to convert floats
  51. doubles and long doubles to and from LONG_FIXED numbers).
  52.  
  53. The Class can be used as you see fit. A donation to me if you feel the
  54. Class is worth it wouldn't upset me in the least.
  55.  
  56. If you want the source code it will cost you $10.00.
  57.  
  58. Mail a check to:
  59.     Stephen R. G. Fraser
  60.     7701 Warner Ave Apt #P228
  61.     Huntington Beach, CA 92647
  62.     USA.
  63.  
  64. (If the check does not have the correct address enclose the correct address
  65.  in the envelope as well).
  66.  
  67. For any questions, suggestions, etc my Compuserve ID is: 73074,3560
  68.  
  69. I hope you enjoy using the LONG_FIXED Class.
  70. Stephen R. G. Fraser
  71.  
  72.